package com.bxait.toymail.ware.dao;

import com.bxait.toymail.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * 
 * @author chen
 * @email 2277411582@qq.com
 * @date 2023-03-13 22:41:32
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    /*
     * @param skuId   商品id
     * @param wareId  库存id
     * @param skuNum  需要增加的商品数量
     * @==============History===============<br/>
     * @Description // TODO  给当前sku增加库存
     * @Date 2023/4/13 23:33
     * @Author <a href="qq:2277411582@qq.com">chen</a>
     * @return void
     */
    void addStock(@Param("skuId") Long skuId,@Param("wareId") Long wareId,@Param("skuNum") Integer skuNum);

    /*
     * @param skuId
     * @==============History===============<br/>
     * @Description // TODO  获取当前的sku商品的库存
     * @Date 2023/4/13 23:34
     * @Author <a href="qq:2277411582@qq.com">chen</a>
     * @return java.lang.Long
     */
    Long getSkuStock(@Param("skuId") Long skuId);


    /*
     * @param skuId
     * @==============History===============<br/>
     * @Description //   获取当前商品的库存信息
     * @Date 2023/5/13 2023/5/13 
     * @Author < a href="2277411582@qq.com">chen</ a>
     * @return java.util.List<java.lang.Long>
     */
    List<Long> listWareIdHasSkuStock(@Param("skuId") Long skuId);

    /*
     * @param skuId
     * @param wareId
     * @param num
     * @==============History===============<br/>
     * @Description //   锁定库存
     * @Date 2023/5/13 2023/5/13
     * @Author < a href="2277411582@qq.com">chen</ a>
     * @return java.lang.Long
     */
    Long lockSkuStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);


    /*
     * @param skuId
     * @param wareId
     * @param num
     * @==============History===============<br/>
     * @Description //   解锁库存
     * @Date 2023/6/18 2023/6/18
     * @Author < a href="2277411582@qq.com">chen</ a>
     * @return void
     */
    void unlockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);

}
